package com.liuliu.controller.zua;

import com.liuliu.common.annotation.Log;
import com.liuliu.common.core.controller.BaseController;
import com.liuliu.common.core.domain.AjaxResult;
import com.liuliu.common.core.page.TableDataInfo;
import com.liuliu.common.enums.BusinessType;
import com.liuliu.common.utils.poi.ExcelUtil;
import com.liuliu.zua.domain.ZuaStudentTeacherClass;
import com.liuliu.zua.service.IZuaStudentTeacherClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 1Controller
 * 
 * @author liuliu
 * @date 2021-03-25
 */
@RestController
@RequestMapping("/zua/studentTeacherClass")
public class ZuaStudentTeacherClassController extends BaseController
{
    @Autowired
    private IZuaStudentTeacherClassService zuaStudentTeacherClassService;

    /**
     * 查询1列表
     */
    @PreAuthorize("@ss.hasPermi('zua:studentTeacherClass:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZuaStudentTeacherClass zuaStudentTeacherClass)
    {
        startPage();
        List<ZuaStudentTeacherClass> list = zuaStudentTeacherClassService.selectZuaStudentTeacherClassList(zuaStudentTeacherClass);
        return getDataTable(list);
    }

    /**
     * 导出1列表
     */
    @PreAuthorize("@ss.hasPermi('zua:studentTeacherClass:export')")
    @Log(title = "1", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ZuaStudentTeacherClass zuaStudentTeacherClass)
    {
        List<ZuaStudentTeacherClass> list = zuaStudentTeacherClassService.selectZuaStudentTeacherClassList(zuaStudentTeacherClass);
        ExcelUtil<ZuaStudentTeacherClass> util = new ExcelUtil<ZuaStudentTeacherClass>(ZuaStudentTeacherClass.class);
        return util.exportExcel(list, "studentTeacherClass");
    }

    /**
     * 获取1详细信息
     */
    @PreAuthorize("@ss.hasPermi('zua:studentTeacherClass:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zuaStudentTeacherClassService.selectZuaStudentTeacherClassById(id));
    }

    /**
     * 新增1
     */
    @PreAuthorize("@ss.hasPermi('zua:studentTeacherClass:add')")
    @Log(title = "1", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZuaStudentTeacherClass zuaStudentTeacherClass)
    {
        return toAjax(zuaStudentTeacherClassService.insertZuaStudentTeacherClass(zuaStudentTeacherClass));
    }

    /**
     * 修改1
     */
    @PreAuthorize("@ss.hasPermi('zua:studentTeacherClass:edit')")
    @Log(title = "1", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZuaStudentTeacherClass zuaStudentTeacherClass)
    {
        return toAjax(zuaStudentTeacherClassService.updateZuaStudentTeacherClass(zuaStudentTeacherClass));
    }

    /**
     * 删除1
     */
    @PreAuthorize("@ss.hasPermi('zua:studentTeacherClass:remove')")
    @Log(title = "1", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zuaStudentTeacherClassService.deleteZuaStudentTeacherClassByIds(ids));
    }
}
